<?php
/*
 * [JINYUN!] (C)2001-2099 Jinyunweb.com
 * This is NOT a freeware, use is subject to license terms
 *订单管理
*/
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'list';
$return=array();
$tabs=array(
	array('op'=>'list','title'=>'全部答题'),
); 
if($_RQ['op']=='list'){
	$return['params']=array();
	$params=array('uniacid'=>$_SESSION['uniacid']);
	if($_RQ['mid']){
		$params['mid']=$_RQ['mid'];
		$return['params']['mid']=$_RQ['mid'];
	}
	if($_RQ['dayid']){
		$params['dayid']=$_RQ['dayid'];
		$return['params']['dayid']=$_RQ['dayid'];
	}
	$pindex = max(1, intval($_RQ['page']));
	$psize = 10;
	$list=pdo_getslice('jy_ailiao_pingdatilog',$params,array($pindex,$psize),$total,$fields,'','createtime desc');
	if($list){
		foreach($list as $k=>&$item){
			$item['member']=cfc('core')->member_show($item['mid']);
			$item['datatitle']=pdo_getcolumn('jy_kaoshi_list',array('uniacid'=>$_SESSION['uniacid'],'id'=>$item['datiid']),'title');
		}
	}
	$return['list']=$list;
	$totalpage=ceil($total/$psize);
	$totalpage=intval($totalpage);
	$return['totalpage'] =$totalpage;
	$return['params']['page'] =$pindex;
	$htmls=array(
		'type'=>'list',
		'tabs'=>$tabs,
		'list'=>array('data'=>'list','edit'=>false,'del_one'=>false,'delall'=>false,'list'=>array(
			array('name'=>'member','title'=>'会员信息_Member','type'=>'member'),
			array('name'=>'datatitle','title'=>'答卷','type'=>'string'),
			array('name'=>'dayid','title'=>'日期','type'=>'string'),
			array('name'=>'score','title'=>'分数','type'=>'string'),
			array('name'=>'allscore','title'=>'总分数','type'=>'string'),
			array('name'=>'createtime','title'=>'时间','type'=>'time'),
		),'action'=>array(
			array('type'=>'href','op'=>'down','title'=>'导出答卷'),
		)),
		'search'=>array(
			array('name'=>'dayid','title'=>'日期','type'=>'string','width'=>15),
			array('type'=>'choose','width'=>15,'action'=>'core/member.get_member/','name'=>'mid','title'=>'选择会员'),
		)
	);
	$return['htmls']=$htmls;	
	exi($return);
}
if($_RQ['op']=='down'){
	$id=intval($_RQ['id']);
	if(!$id){
		exi('下载出错！','error');
	}
	$url=download_url('jy_kaoshi/ping.datilog/down_load/id='.$id);
	exi('点确定开始下载','',$url);
}
if($_RQ['op']=='down_load'){
	$id=intval($_RQ['id']);
	$this->model('ping')->down_canyu($id);
}
